package com.yanqu.road.server.cmd.activity.ghost;

import com.yanqu.road.pb.activity.GhostActivityProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.cross.battle.ghost.GhostMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;

@Cmd(code = CrossProtocol.C2_GHOST_ACTIVITY_HELP_CODE, desc = "鬼市修复代码")
public class CrossGhostHelpCodeCmd extends CrossCommand {

    private int activityId;
    private int type;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        GhostActivityProto.GhostHelpCode reqMsg = GhostActivityProto.GhostHelpCode.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        type = reqMsg.getType();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        if (type == 1) {
            GhostMgr.reloadConfig(activityId);
        } else if (type == 2) {
            GhostMgr.repair(activityId);
        }
    }

    @Override
    public void sendData() {

    }
}
